package com.nanhang.controller;


import com.nanhang.entity.User;
import com.nanhang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
// @Controller
// @ResponseBody
// 前面两个相当于下面@RestController
@RestController
@RequestMapping("/user")
public class UserController {

	@Autowired
	private UserService userService;

	@GetMapping("/list")
	// @ResponseBody               // 将java对象转换为json字符串
	public List<User> list(){
		return userService.findAll();
	}
}
